package com.xinxin.leetcode.problem453;

import java.util.Arrays;

/**
 * @author ShiXinXin
 * @date 2020-01-03 13:50
 */
public class Solution {
    public int minMoves(int[] nums) {
        Arrays.sort(nums);
        int sum = 0;
        for (int i = 1; i < nums.length; i++) {
            sum += nums[i] - nums[0];
        }
        return sum;
    }

    public static void main(String[] args) {
        int[] arr = {1, 2, 3};
        System.out.println(new Solution().minMoves(arr));
    }
}
